package com.itheima.springbootwebtlias.mapper;

import com.itheima.springbootwebtlias.pojo.Emp;
import com.itheima.springbootwebtlias.pojo.EmpQueryParam;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

@Mapper
public interface EmpMapper {

    /*@Select(" select e.*, d.name  from emp as e " +
            "left join dept as d on e.dept_id = d.id" +
            "        where e.name like concat('%',#{name},'%')" +
            "          and e.gender = #{gender}" +
            "          and e.entry_date between #{begin} and #{end}")*/
    // 根据条件分页查询员工
    List<Emp> selectByCondition(EmpQueryParam empQueryParam);

    // 新增员工
    void insert(Emp emp);

    // 查询所有员工
    @Select("select * from emp")
    List<Emp> queryAllEmp();

    // 批量删除员工
    void deleteBatchById(List<Integer> ids);

    //  根据id查询员工 + 修改员工信息+ 查询员工经历
    @Select("select * from emp where id = #{id}")
    Emp selectById(Integer id);

    // 更新员工信息
    void update(Emp emp);

    //统计职位数据柱状图
    List<Map> jobCount();

    //统计员工性别数据饼状图
    List<Map> genderCount();

    // 根据用户名查询员工
    @Select("select * from emp where username = #{username}")
    Emp selectByUsername(String username);
}
